#include <iostream>
#include <iomanip> // 用于设置输出格式

class BankAccount {
private:
    long long balance; // 账户余额，以分为单位，只能通过公共成员函数访问

public:
    // 构造函数，初始余额以元为单位，内部转换为分
    BankAccount(double initialBalance) : balance(static_cast<long long>(initialBalance * 100)) {}

    // 存款操作，输入金额以元为单位，内部转换为分
    void deposit(double amount) {
        if (amount > 0) {
            long long amountInCents = static_cast<long long>(amount * 100);
            balance += amountInCents;
            std::cout << "Deposit " << std::fixed << std::setprecision(2) << amount 
                      << ", New Balance: " << static_cast<double>(balance) / 100 << std::endl;
        }
    }

    // 取款操作，输入金额以元为单位，内部转换为分
    bool withdraw(double amount) {
        long long amountInCents = static_cast<long long>(amount * 100);
        if (amount > 0 && amountInCents <= balance) {
            balance -= amountInCents;
            std::cout << "Withdraw " << std::fixed << std::setprecision(2) << amount
                      << ", New Balance: " << static_cast<double>(balance) / 100 << std::endl;
            return true;
        }
        return false;
    }

    // 获取当前余额，返回值以元为单位
    double getBalance() const {
        return static_cast<double>(balance) / 100;
    }
};

int main() {
    BankAccount account(1000.0); // 创建一个初始余额为1000元的账户
    account.deposit(500.0); // 存入500元
    account.withdraw(200.0); // 取出200元
    std::cout << "Final Balance: " << std::fixed << std::setprecision(2) << account.getBalance() << std::endl; // 显示最终余额

    return 0;
}